Skip to content

PostgreSQL: parse CREATE GROUP - #2429

Open
LucaCappelletti94 wants to merge 8 commits into
apache:mainfrom
LucaCappelletti94:pg-create-drop-group
Open

LucaCappelletti94 wants to merge 8 commits into
apache:mainfrom
LucaCappelletti94:pg-create-drop-group

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

PostgreSQL accepts CREATE GROUP as an obsolete spelling of CREATE ROLE. Parse it into CreateRole and preserve the GROUP keyword when formatting, since Amazon Redshift distinguishes user groups from roles.

DROP GROUP and ALTER GROUP are left for separate PRs.

PostgreSQL syntax reference https://www.postgresql.org/docs/current/sql-creategroup.html

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review August 5, 2026 14:13
@LucaCappelletti94
LucaCappelletti94 force-pushed the pg-create-drop-group branch 2 times, most recently from a81ad93 to eb95863 Compare August 24, 2026 11:52
@LucaCappelletti94
LucaCappelletti94 force-pushed the pg-create-drop-group branch 4 times, most recently from 12418e2 to bc8d980 Compare September 22, 2026 21:20
LucaCappelletti94 added a commit to LucaCappelletti94/sqlparser-rs that referenced this pull request Oct 2, 2026
@codecov-commenter

codecov-commenter commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.03%. Comparing base (594bb04) to head (20d98f8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2429      +/-   ##
==========================================
+ Coverage   81.99%   82.03%   +0.03%     
==========================================
  Files          42       42              
  Lines       35049    35081      +32     
  Branches    35049    35081      +32     
==========================================
+ Hits        28740    28777      +37     
+ Misses       2744     2736       -8     
- Partials     3565     3568       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 force-pushed the pg-create-drop-group branch 3 times, most recently from 2ed5332 to a99e919 Compare October 17, 2026 01:00
@LucaCappelletti94 LucaCappelletti94 added the enhancement New feature or request label Oct 18, 2026

@sabir-akhadov-localstack sabir-akhadov-localstack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One non-blocking comment inline.

Comment thread src/parser/mod.rs Outdated
&mut self,
role_keyword: RoleKeyword,
) -> Result<CreateRole, ParserError> {
let if_not_exists = matches!(role_keyword, RoleKeyword::Role)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostgreSQL rejects IF NOT EXISTS for CREATE ROLE too, so this guard only makes the two spellings diverge: CREATE GROUP IF NOT EXISTS g now takes IF as the group name and fails with Expected: end of statement, found: NOT. Either drop the guard to keep parity with ROLE, or reject it with an explicit error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it rejects consistently in both cases

@LucaCappelletti94
LucaCappelletti94 force-pushed the pg-create-drop-group branch 4 times, most recently from 7ee5832 to 85ff986 Compare October 24, 2026 06:32
@LucaCappelletti94 LucaCappelletti94 changed the title PostgreSQL: parse CREATE GROUP and DROP GROUP PostgreSQL: parse CREATE GROUP Oct 24, 2026
@LucaCappelletti94 LucaCappelletti94 added the waiting on reviewer PR needs to be reviewed label Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PostgreSQL waiting on reviewer PR needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants